import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
   {
     title: '区域类型',
     align: "center",
     dataIndex: 'regionType_dictText'
   },
   {
    title: '仓库编码',
    align:"center",
    sorter: true,
    dataIndex: 'number'
   },
   {
    title: '仓库名称',
    align:"center",
    sorter: true,
    dataIndex: 'name'
   },
   {
    title: '所在位置',
    align:"center",
    dataIndex: 'position'
   },
   {
    title: '占地面积（㎡）',
    align:"center",
    sorter: true,
    dataIndex: 'floorSpace'
   },
   {
    title: '仓库管理员',
    align:"center",
    dataIndex: 'manager'
   },
   {
    title: '联系方式',
    align:"center",
    dataIndex: 'tel'
   },
   {
    title: '有无防火墙',
    align:"center",
    dataIndex: 'isFirewall_dictText'
   },
   {
    title: '仓库用途',
    align:"center",
    dataIndex: 'warehouseUse_dictText'
   },
   {
    title: '存放物体形态',
    align:"center",
    dataIndex: 'mediumForm_dictText'
   },
   {
    title: '设计使用年限',
    align:"center",
    dataIndex: 'ageLimit'
   },
   {
    title: '火灾危险等级',
    align:"center",
    dataIndex: 'fireGrade_dictText'
   },
   {
    title: '状态',
    align:"center",
    dataIndex: 'status_dictText'
   },
   {
    title: '租户id',
    align:"center",
    dataIndex: 'tenantId'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
	  label: "区域类型",
	  field: 'regionType',
	  component: 'JDictSelectTag',
	  componentProps:{
	    dictCode: "regionType"
	  },
	  //colProps: {span: 6},
	},
	{
      label: "仓库编码",
      field: "number",
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "仓库名称",
      field: "name",
      component: 'Input',
      //colProps: {span: 6},
 	},
	{
      label: "有无防火墙",
      field: "isFirewall",
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"haveOrNot"
      },
      //colProps: {span: 6},
 	},
	{
      label: "仓库用途",
      field: "warehouseUse",
      component: 'JDictSelectTag',
      componentProps:{
          dictCode:"warehouseUse"
      },
      //colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '区域类型',
    field: 'regionType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "regionType"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入区域类型!'},
             ];
    },
  },
  {
    label: '仓库编码',
    field: 'number',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入仓库编码!'},
          ];
     },
  },
  {
    label: '仓库名称',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入仓库名称!'},
          ];
     },
  },
  {
    label: '所在位置',
    field: 'position',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入所在位置!'},
          ];
     },
  },
  {
    label: '占地面积（㎡）',
    field: 'floorSpace',
    component: 'Input',
  },
  {
    label: '仓库管理员',
    field: 'manager',
    component: 'Input',
  },
  {
    label: '联系方式',
    field: 'tel',
    component: 'Input',
  },
  {
    label: '有无防火墙',
    field: 'isFirewall',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"haveOrNot"
     },
  },
  {
    label: '仓库用途',
    field: 'warehouseUse',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"warehouseUse"
     },
  },
  {
    label: '存放物体形态',
    field: 'mediumForm',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"mediumForm"
     },
  },
  {
    label: '设计使用年限',
    field: 'ageLimit',
    component: 'InputNumber',
  },
  {
    label: '火灾危险等级',
    field: 'fireGrade',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"fireDangerGrade"
     },
  },
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"normalOrStop"
     },
  },
  {
    label: '租户id',
    field: 'tenantId',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
//子表表格配置
export const tbBasicsStashProductColumns: JVxeColumn[] = [
    {
      title: '存储物质名称',
      key: 'name',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: 'CAS号',
      key: 'casCode',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '最大在线量',
      key: 'maxAmountOnline',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '计量单位',
      key: 'unit',
      type: JVxeTypes.select,
      options:[],
      dictCode:"measurementUnit",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '涉及危险工艺',
      key: 'technology',
      type: JVxeTypes.select,
      options:[],
      dictCode:"processType",
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]

// 高级查询数据
export const superQuerySchema = {
  regionType: {title: '区域类型',order: 0,view: 'text', type: 'string',dictCode: 'regionType',},
  number: {title: '仓库编码',order: 1,view: 'text', type: 'string',},
  name: {title: '仓库名称',order: 2,view: 'text', type: 'string',},
  position: {title: '所在位置',order: 3,view: 'text', type: 'string',},
  floorSpace: {title: '占地面积（㎡）',order: 4,view: 'text', type: 'string',},
  manager: {title: '仓库管理员',order: 5,view: 'text', type: 'string',},
  tel: {title: '联系方式',order: 6,view: 'text', type: 'string',},
  isFirewall: {title: '有无防火墙',order: 7,view: 'radio', type: 'string',},
  warehouseUse: {title: '仓库用途',order: 8,view: 'list', type: 'string',dictCode: 'warehouseUse',},
  mediumForm: {title: '存放物体形态',order: 9,view: 'list', type: 'string',dictCode: 'mediumForm',},
  ageLimit: {title: '设计使用年限',order: 10,view: 'number', type: 'number',},
  fireGrade: {title: '火灾危险等级',order: 11,view: 'list', type: 'string',dictCode: 'fireDangerGrade',},
  status: {title: '状态',order: 12,view: 'radio', type: 'string',},
  tenantId: {title: '租户id',order: 13,view: 'text', type: 'string',},
  //子表高级查询
  tbBasicsStashProduct: {
    title: '仓库产品',
    view: 'table',
    fields: {
        name: {title: '存储物质名称',order: 0,view: 'text', type: 'string',},
        casCode: {title: 'CAS号',order: 1,view: 'text', type: 'string',},
        maxAmountOnline: {title: '最大在线量',order: 2,view: 'text', type: 'string',},
        unit: {title: '计量单位',order: 3,view: 'list', type: 'string',dictCode: 'measurementUnit',},
        technology: {title: '涉及危险工艺',order: 4,view: 'list', type: 'string',dictCode: 'processType',},
    }
  },
};
